package club.bigtian.sync.model;

import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;

/**
 * 数据行
 * 表示一行数据
 */
public class DataRow {
    private String tableName;
    private Map<String, Object> values = new HashMap<>();
    private Long version; // 将 version 改为 Timestamp 类型
    private byte isDeleted = 0; // 添加 isDeleted 字段，初始值为 0（未删除）

    /**
     * 获取指定列的值
     *
     * @param columnName 列名
     * @return 列值
     */
    public Object getValue(String columnName) {
        return values.get(columnName);
    }

    /**
     * 设置指定列的值
     *
     * @param columnName 列名
     * @param value 列值
     */
    public void setValue(String columnName, Object value) {
        values.put(columnName, value);
    }


    public byte getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(byte isDeleted) {
        this.isDeleted = isDeleted;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public Map<String, Object> getValues() {
        return values;
    }

    public void setValues(Map<String, Object> values) {
        this.values = values;
    }

    public Long getVersion() {
        return version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }
}